﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    //public String textParcurs = "ZERO";
    protected void Page_Load(object sender, EventArgs e)
    {
        //ModelActive.Attributes.Add("onclick", "startNicEditorOnModel()");
        GenreHiddenTextArea.Value = MFRadioButtonList.SelectedItem.Text;

        if (!IsPostBack)
        {
            DataList1.DataBind();
            
            //Literal1.Text = HiddenTextbox.Text;
            //litTopic.Text = "<DIV><FONT size=3><DIV><B>My Favorite Site: </B>www.covertcoder.com</DIV></FONT></DIV>";
            //Literal1.Text = "<DIV><FONT size=3><DIV><B>My 2'nd Favorite Site: </B>www.covertcoder.com</DIV></FONT></DIV>";

        }

        if (IsPostBack)
        {
            // NOTE: the following uses an overload of RegisterClientScriptBlock() 
            // that will surround our string with the needed script tags 
            ClientScript.RegisterClientScriptBlock(GetType(), "IsPostBack", "var isPostBack = true;", true);
        }


    }

    //protected void NicEditButton_Click(object sender, EventArgs e)
    //{
    //    litTopic.Text = "zaza";
    //    //litTopic.Text = TextBox2.Text;

    //    if (NicEditButton.Text == "Activeaza Editarea")
    //    {
    //        NicEditButton.Text = "Dezactiveaza Editarea";
    //    }
    //    else NicEditButton.Text = "Activeaza Editarea";
    //}

    protected void ModelActive_CheckedChanged(object sender, EventArgs e)
    {
        if (SelectModel.Enabled == false)
        {
                SelectModel.Enabled = true;
                ModelText.Visible = true;
                ModelTextTitle.Visible = true;
            }
        else
        {
            SelectModel.Enabled = false;
            ModelText.Visible = false;
            ModelTextTitle.Visible = false;
        }
    }

    protected void TextGenerator_TextChanged(object sender, EventArgs e)
    {
        //ShowAlertMessage("na aci");
    }


    public static void ShowAlertMessage(string message)
    {

        Page page = HttpContext.Current.Handler as Page;
        if (page != null)
        {
            message = message.Replace("'", "\'");
            System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + message + "');", true);
        }
    }
    protected void MFRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
    {
        GenreHiddenTextArea.Value = MFRadioButtonList.SelectedItem.Text;
    }
}
